import { Injectable, NestMiddleware } from "@nestjs/common";

import { createProxyMiddleware } from "http-proxy-middleware";


@Injectable()
export class proxyMiddleware  implements NestMiddleware{
  private jsonPlaceholderProxy = createProxyMiddleware({
    target: 'http://192.168.10.67:8095',
    changeOrigin: true,
    hostRewrite: "localhost:3000",
    ws:true,
    logLevel: 'error',
  });
  use(req: any, res: any, next: () => void) {
    // console.log(req.baseUrl);
    this.jsonPlaceholderProxy(req, res, next)
  }
}
